
<!DOCTYPE html>
<html>
<head>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>

<link rel="stylesheet" type="text/css" href="theme/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="theme/default/css/common.css">
<script src="theme/default/Js/Common.js"></script>
<script src="theme/default/Js/jquery.min.js"></script>
<script src="theme/default/js/artDialog.js?skin=blue"></script>
<link rel="stylesheet" type="text/css" href="include/webupload/webuploader.css">
<script src="include/webupload/webuploader.min.js"></script> 
<script src="include/webupload/uploads.js"></script>
<link rel='stylesheet' type="text/css" href='/theme/desktop/css/font-awesome.min.css'>

</head>
<body>

<script>
	<!-- 必填项提示
	function CheckInput()
	{
		if (1=="1"){if(document.all.oLinkman.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '联系人不能为空!'});document.all.oLinkman.focus();return false;}}
		if (1=="1"){if(document.all.oSDate.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '下单日期不能为空!'});document.all.oSDate.focus();return false;}}
		if (0=="1"){if(document.all.oEDate.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '交单日期不能为空!'});document.all.oEDate.focus();return false;}}
		if (1=="1"){if(document.all.oDeposit.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '已收款不能为空!'});document.all.oDeposit.focus();return false;}}
		if (0=="1"){if(document.all.oContent.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '详情备注不能为空!'});document.all.oContent.focus();return false;}}
		if (0=="1"&&0!="1"){if(document.all.oshr.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '收货人不能为空'});document.all.oshr.focus();return false;}}
		if (0=="1"&&0!="1"){if(document.all.oshrdh.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '收货人电话不能为空'});document.all.oshrdh.focus();return false;}}
		if (0=="1"&&0!="1"){if(document.all.oshrdz.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '收货人地址不能为空'});document.all.oshrdz.focus();return false;}}
		
		

if(document.all.spmc.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '商品名称'+"不能为空!"});document.all.spmc.focus();return false;}

if(document.all.GengHuaSuanDe.value == ""){art.dialog({title: 'Error',time: 1,icon: 'warning',content: '更划算的'+"不能为空!"});document.all.GengHuaSuanDe.focus();return false;}

		
	}
	-->
	</script>

<!----------------------------------------修改订单管理开始----------------------------------------> 
<!----------------------------------------修改订单管理开始---------------------------------------->
<div class="cssout">
  <form class="layui-form" name="save" action="?action=order&stype=saveEdit&LaiLu=" method="post" onSubmit="return CheckInput();">
    <div class="cssin">
      <ul>
        <div class="part1" style="display:none;">
          <li class="w100 bg">
            <dd class="isin"><B>修改订单管理</B></dd>
          </li>
          <li class="w10 bg cl tr">
            <dd class="isin"> 订单编号</dd>
          </li>
          <li class="w90">
            <dd class="isin"> DD2017122002170 <span class="info_help help01" >&nbsp;不可修改</span></dd>
          </li>
          <li class="w10 bg cl tr">
            <dd class="isin">客户名称</dd>
          </li>
          <li class="w40">
            <dd class="isin"> 暗示 </dd>
          </li>
          <li class="w10 bg tr">
            <dd class="isin">
              
              <font color="#FF0000">*</font>
              联系人</dd>
          </li>
          <li class="w40">
            <dd class="isin">
              <select name="oLinkman" id="oLinkman" onChange="Getselectids();" style='border:1px solid #f00;'><option value="">请选择</option><option value="阿萨德" tel="" selected>阿萨德</option></select>
              &nbsp;
              <input name="Back" type="button" id="Back" class="btn1 btnxinz" value="新增" onclick='Linkmans_Infoadd("linkmansave.asp?action=Linkmans&stype=add&cID=7&LaiLu=")'>
              <script>function Linkmans_Infoadd(Dourl) {$.dialog.open(Dourl, {title: '新增联系人', width: 500, height: 500,fixed: true}); };</script> 
              <span id="linktel"> 电话：<b style="color:red;"></b></span> 
              <script>
function Getselectids(){
	var telmr=$("#oLinkman").find("option:selected").attr("tel")
	if(telmr!=""){
		$("#linktel b").text(telmr)
	}else{
		$("#linktel b").text(" 未查询到信息")
	}
}
  Getselectids()
</script> 
            </dd>
          </li>
          <li class="w10 bg cl tr">
            <dd class="isin">
              订单总金额</dd>
          </li>
          <li class="w40">
            <dd class="isin">
              <input name="omoney" type="text" id="omoney" class="bor int nohover" size="10" value="5000" readonly/>
              元</dd>
          </li>
          <li class="w10 bg tr">
            <dd class="isin">
              
              <font color="#FF0000">*</font>
              已收款</dd>
          </li>
          <li class="w40">
            <dd class="isin">
              <input name="oDeposit" type="text" id="oDeposit" class="bor int" size="10" value="0" onFocus="if (value =='0'){value =''}"onblur="if (value ==''){value='0'}" />
              元</dd>
          </li>
          <li class="w10 bg cl tr">
            <dd class="isin">
              
              <font color="#FF0000">*</font>
              下单日期</dd>
          </li>
          <li class="w40">
            <dd class="isin">
              <input name="oSDate" type="text" id="oSDate" class="int Wdate" size="15" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="2017-12-20" />
            </dd>
          </li>
          <li class="w10 bg tr">
            <dd class="isin">
              交单日期</dd>
          </li>
          <li class="w40">
            <dd class="isin">
              <input name="oEDate" type="text" id="oEDate" class="int Wdate" size="15" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="" />
            </dd>
          </li>
          
          <!--2017.06.20-->
          <li class="w10 bg cl tr" >
            <dd class="isin">
              
              收货人</dd>
          </li>
          <li class="w40" >
            <dd class="isin">
              <input type="text" name="oshr" id="oshr" class="bor int" size="30" value=""  />
            </dd>
          </li>
          <li class="w10 bg tr" >
            <dd class="isin">
              
              收货人电话</dd>
          </li>
          <li class="w40" >
            <dd class="isin">
              <input type="text" name="oshrdh" id="oshrdh" class="bor int" size="30" value=""  />
            </dd>
          </li>
          <li class="w10 bg cl tr" >
            <dd class="isin">
              
              收货人地址</dd>
          </li>
          <li class="w90" >
            <dd class="isin">
              <input type="text" name="oshrdz" id="oshrdz" class="bor int" size="50" value=""  />
            </dd>
          </li>
          <!--end-->
          
          
          <li class="w25 bg tr ovh"><dd class="isin">  <font color="#FF0000">*</font> 商品名称</dd></li>
<li class="w75"><dd class="isin">
  
  <select name="spmc" id="spmc" class="bor int" style="width:px">
    <option value="">请选择</option>
    <option value="男神" selected>男神</option><option value="女神">女神</option><option value="示例选项3">示例选项3</option><option value="哈哈">哈哈</option>
</select>

</dd></li>

          <li class="w25 bg tr ovh"><dd class="isin">  <font color="#FF0000">*</font> 更划算的</dd></li>
<li class="w75"><dd class="isin">
  
  <input name="GengHuaSuanDe" type="text" id="GengHuaSuanDe" class="bor int" size="30" style="width:px" value="111">
  
</dd></li>

                            
                            
                            
                            
                            
                            
                            
                            
<div class="zidonggaodu fujian">
        <li class="w10 cl bg tr">
          <dd class="isin">
            附件</dd>
        </li>
        <li class="w90">
          <dd class="isin">
<div class="cssoutfujian">
  <ul class="listpic2">

  </ul>
</div>
          
<span id="fujian1"> </span>
<script>
//定义一个上传
var upName1 = $("#fujian1").powerWebUpload(
{ 
	auto: true,//上传后是否自动上传
	fileNumLimit:10,//允许上传个数
	accept: {
	   title: '上传附件',
	   extensions: 'gif,jpg,png,bmp,doc,docx,xls,xlsx,ppt,pdf,rar,zip,txt',//允许类型 原始：'gif,jpg,jpeg,bmp,png'
	   mimeTypes: '*'//类型 原始：'image/*'
	}//限制的配置信息
});
//绑定上传完成事件 file 参数中有 原始名称 大小 后缀 类型等等参数；percentage是服务返回的参数 有信息 和图片地址
    upName1.on('uploadSuccess', function (file, percentage) {
	$("#fujianlist").val(percentage.data.src);
	
});
</script>
          </dd>
        </li>
        <div class="clear"></div>
</div>         
                            
                            
                            
                            
                            
          <li class="w10 bg cl duohang tr">
            <dd class="isin">
              详情备注</dd>
          </li>
          <li class="w90 duohang">
            <dd class="isin">
              <textarea name="oContent" rows="4" id="oContent" class="bor int" style="height:65px;width:98%;">
</textarea>
            </dd>
          </li>
        </div>
        <div class="part2">
          <div class="cssout">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td class="top_left" style="font-weight:bold;">产品明细
                  </td>
                <td class="top_left" style="text-align:center;"><div class="jszh">单价总和：<span id="zh01" class="zhjg"></span> 数量总和：<span id="zh02" class="zhjg"></span> 折扣总和：<span id="zh03" class="zhjg"></span> 最终总金额：<span id="zh04" class="zhjg"></span></div></td>
                <td class="top_right"><a class="btn1 btnchanpin" id="btn_addtr" onclick='choose_cp("listorder_cpadd.html?action=choose&stype=cp&otype=order&lei=chuku&LaiLu=")' style="background:#096;"><i class="fa fa-plus-circle"></i> 新增产品</a> 
                  <script>function choose_cp(Dourl) {$.dialog.open(Dourl, {title: '新增订单产品', width: 1000, height: 500,fixed: true}); };</script></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" CLASS="table_1" style="border-bottom:none;">
              <tr class="tr_t">
                <td width="50" class="td_l_c">序号</td>
                <td width="160" class="td_l_l">产品名称</td>
                
                <td width="60" class="td_l_c">规格</td>
                
                <td width="60" class="td_l_c">型号</td>
                
                <td width="60" class="td_l_c">成本单价</td>
                
                <td width="60" class="td_l_c">销售单价</td>
                <td width="60" class="td_l_c">数量</td>
                <td width="60" class="td_l_c">折扣</td>
                <td width="80" class="td_l_c">商品总金额</td>
                <td width="100" class="td_l_c">备注</td>
                <td width="80" class="td_l_c">录入时间</td>
                <td width="60" class="td_l_c">退货</td>
                <td width="60" class="td_l_c">管理</td>
              </tr>
              
              <tr class="tr">
                <td class="td_l_c">1
                <input name="oldosid" type="hidden" class="bor int" size="4" value="11"/>
                <input name="xproid" type="hidden" class="bor int" size="4" value="2"/>
                </td>
                <td class="td_l_l">女神</td>
                
                <td class="td_l_c">500</td>
                
                <td class="td_l_c">1</td>
                
                <td class="td_l_c">500</td>
                
                <td class="td_l_c">
                <input name="xopprice" class="xopprice bor int" size="6" type="text" value="5000">
                <span class="wben">
                  5000
                </span>
                  </td>
                <td class="td_l_c">
                <input name="xopnum" class="xopnum bor int" size="6" type="text" value="1">
                <span class="wben">
                1
                </span> 
                  </td>
                <td class="td_l_c">
                <input name="xodiscount" class="xodiscount bor int" size="6" type="text" value="0">
                <span class="wben">
                  0
                </span>
                  </td>
                <td class="td_l_c">
                <input name="xomoney" type="text" class="xomoney bor int nohover" size="6" value="5000" readonly />
                
                  <span class="wben">
                  5000
                  </span>
                  
                  
                  </td>
                <td class="td_l_c">
                <input name="xocontent" type="text" class="bor int" size="12" value=""/>
                <span class="wben">
				
                </span>
                
                </td>
                <td class="td_l_c">2017-12-20</td>
                <td class="td_l_c">
                
                <a class="open-app" data-width="500" data-height="300" title="退货" href="order_chuli.asp?action=tuihuo&stype=tuihuo&osid=11&LaiLu=">
                
                
                无
                
                
                
                
                </a>
                
                
                </td>
                <td class="td_l_c">
                
                <!--<input type="button" class="btnx btnxiug" value="修改" title="修改" onClick="bdanxs()" />-->
<script>
bdanxs()
function bdanxs(){
$(".wben").css("display","none")
}
</script>        
                
                <!--<input type="button" class="btnx btnxiug" value="修改" title="修改" onclick='order_cp_InfoEdit11("ordersave.asp?action=ordercp&stype=Edit&Id=11&LaiLu=")' />-->
                
                  <input type="button" class="btnx btnshanc" value="删除" title="删除" onclick='order_cp_InfoDel11("ordersave.asp?action=ordercp&stype=Delete&Id=11&LaiLu=")' /></td>
              </tr>
              <script>function order_cp_InfoEdit11(Dourl) {$.dialog.open(Dourl, {title: '编辑', width: 600,height: 500, fixed: true}); };</script> 
              <script>function order_cp_InfoDel11(Dourl) {$.dialog( { content: '是否确定删除?<br>删除不可恢复且不退库存！',icon: 'error',ok: function () { art.dialog.open(Dourl);return false;},cancel: true }); };</script>
              
              
              <!--动态表格开始，前面还有一个固定表格-->
              
              <input name="choosecpxx" id="choosecpxx" type="hidden" class="bor int" size="50" value="" />
              <table id="TabMuban" style="display: none">
                <tbody>
                  <tr class="tr">
                    <td width="50" class="td_l_c"><span class="noxh">1</span>
                    <input name="oldosid" type="hidden" class="bor int" size="4" value="0"/>
                    <input name="xproid" type="hidden" class="bor int" size="4" value=""/>
                    </td>
                    <td width="160" class="td_l_l">
                      <span class="xoname"></span></td>
                    
                    <td width="60" class="td_l_c"><span class="xoguige"></span></td>
                    
                    <td width="60" class="td_l_c"><span class="xoxinghao"></span></td>
                    
                    <td width="60" class="td_l_c"><span class="xochengben"></span></td>
                    
                    <td width="60" class="td_l_c"><input name="xopprice" type="text" class="bor int" size="6" value=""/></td>
                    <td width="60" class="td_l_c"><input name="xopnum" type="text" class="bor int" size="6" value=""/></td>
                    <td width="60" class="td_l_c"><input name="xodiscount" type="text" class="bor int" size="6" value=""/></td>
                    <td width="80" class="td_l_c"><input name="xomoney" type="text" class="bor int nohover" size="6" value="" readonly /></td>
                    <td width="100" class="td_l_c"><input name="xocontent" type="text" class="bor int" size="12" value=""/></td>
                    <td width="80" class="td_l_c">2017/12/20</td>
                    <td width="60" class="td_l_c">--</td>
                    <td width="60" class="td_l_c"><input type="button" class="btnx btnshanc" value="删除" title="删除" onClick="deltr(this)"></td>
                  </tr>
                </tbody>
              </table>
              <table id="TabUse" width="100%" border="0" cellpadding="0" cellspacing="0">
                <thead style="display:none;">
                  <tr class="tr_b">
                    <td width="50" class="td_l_c">序号</td>
                    <td width="160" class="td_l_l">产品名称</td>
                    
                    <td width="60" class="td_l_c">规格</td>
                    
                    <td width="60" class="td_l_c">型号</td>
                    
                    <td width="60" class="td_l_c">成本单价</td>
                    
                    <td width="60" class="td_l_c">销售单价</td>
                    <td width="60" class="td_l_c">数量</td>
                    <td width="60" class="td_l_c">折扣</td>
                    <td width="80" class="td_l_c">商品总金额</td>
                    <td width="100" class="td_l_c">备注</td>
                    <td width="80" class="td_l_c">录入时间</td>
                    <td width="60" class="td_l_c">退货</td>
                    <td width="60" class="td_l_c">管理</td>
                  </tr>
                </thead>
                <tbody>
                </tbody>
              </table>
              <!--动态表格结束-->
              
            </table>
            
          </div>
        </div>
        
        
        
        
        
        
        
        
        <div class="clear"></div>
      </ul>
    </div>
    <div class="h50b"></div>
    <div class="fixed_bg_B">
      <input name="oID" type="hidden" value="5">
      <input type="submit" name="Submit" class="btn2 btnbaoc" value="保存">
      <input name="Back" type="button" id="Back" class="btn2 btnguanb" value="关闭" onClick="art.dialog.close();guanbi();">
      
       
      
    </div>
  </form>
</div>

<script>
 var show_count = 20;  //要显示的条数
     
      var count = 1;  //递增的开始值，这里是你的ID
      jQuery(document).on("click","#btn_addtr",function () {
		  
	  jQuery("#choosecpxx").val("")  //先清空获取框的值
        var length = $("#TabUse tbody tr").length;
        if (length < show_count)  //点击时候，如果当前的数字小于递增结束的条件
        {
          $("#TabMuban tbody tr").clone().appendTo("#TabUse tbody");  //在表格后面添加一行
          changeIndex();//更新行号
        }
      });
  
  
	function btnAddtrClick(){
		$("#choosecpxx").val("")  //先清空获取框的值
        var length = $("#TabUse tbody tr").length;
        if (length < show_count)  //点击时候，如果当前的数字小于递增结束的条件
        {
          $("#TabMuban tbody tr").clone().appendTo("#TabUse tbody");  //在表格后面添加一行
          changeIndex();//更新行号
        }
	}
    function changeIndex() {
	
		
      var i = $(".table_1").find("tr").length;
      $("#TabUse tbody tr").each(function () { //循环tab tbody下的tr
        $(this).find(".noxh").html("<span style='color:#f00;'>"+(i++)+"</span>");//更新行号
		$(this).attr("id", "tr"+i);
		$(this).attr("data-id", i);
      });
    }
  
    function deltr(opp) {
      var length = $("#TabUse tbody tr").length;
      /*if (length <= 1) {
        alert("至少保留一行");
      } else {*/
        $(opp).parent().parent().remove();//移除当前行
        changeIndex();
		qiuzonghe();//计算总数
      /*}*/
    }
function ChosecpOK(){
var max_id = 0;
$("#TabUse tbody tr").each(function () { //循环tab tbody下的tr的data-id值
  var data_id = parseInt($(this).attr("data-id"));
  if (data_id > max_id) {
   max_id = data_id;
  }
})
  
var trid="#tr"+max_id
var choosecpxx=$("#choosecpxx").val()
arr=choosecpxx.split('|');//注split可以用字符或字符串分割
for(var i=0;i<arr.length;i++)
{
$(trid+" input[name='xproid']").val(arr[0])
$(trid+" .xoname").text(arr[1])
$(trid+" .xoguige").text(arr[2])
$(trid+" .xoxinghao").text(arr[3])
$(trid+" .xochengben").text(arr[4])	
$(trid+" input[name='xopprice']").val(arr[5])
$(trid+" input[name='xopnum']").val(arr[6])
$(trid+" input[name='xodiscount']").val(arr[7])
$(trid+" input[name='xomoney']").val(arr[5])
$(trid+" input[name='xocontent']").val(arr[9])
//alert(arr[i]);
}
qiuzonghe();
}
//委托绑定事件
$(document).on('change',"input[name='xopprice'],input[name='xopnum'],input[name='xodiscount'],",function(event) {
	var that = $(this),//得到当前对象
	parentTr = that.parent().parent();//得到tr父级
	var xopprice = parentTr.find("input[name='xopprice']").val(),//获取单价
		xopnum = parentTr.find("input[name='xopnum']").val(),//获取数量
		xodiscount = parentTr.find("input[name='xodiscount']").val();//获取折扣
		//xodiscount = xodiscount<=0?1:xodiscount;//折扣不能小于等0，否则为1
	var priceCount = xopprice*xopnum-xodiscount;//计算总金额
	parentTr.find("input[name='xomoney']").val(priceCount);//结果赋值给总金额
//}).on("click","#btnCountPrice",function(){
}).on('change',"input[name='xopprice'],input[name='xopnum'],input[name='xodiscount'],",function(){
	qiuzonghe()
});
qiuzonghe()
function qiuzonghe(){
	var xopprices=0,//单价
	xopnums=0,//数量
	xodiscount=0,//折扣
	priceCount=0;//总价
	//获取单价集合
	$("#TabUse input[name='xopprice'],.xopprice").each(function(index, el) {
		xopprices += $(el).val()==''?0:parseInt($(el).val());
	});
	//获取数量集合
	$("#TabUse input[name='xopnum'],.xopnum").each(function(index, el) {
		xopnums += $(el).val()==''?0:parseInt($(el).val());
	});
	//获取折扣集合
	$("#TabUse input[name='xodiscount'],.xodiscount").each(function(index, el) {
		xodiscount +=  $(el).val()==''?0:parseInt($(el).val());
	});
	//获取折扣集合
	$("#TabUse input[name='xomoney'],.xomoney").each(function(index, el) {
		priceCount +=  $(el).val()==''?0:parseInt($(el).val());
	});
	//priceCount = xopprices*xopnums-xodiscount;//总价
	if(isNaN(priceCount)){ priceCount = 0}
	
	$("#zh01").text(xopprices+"元")
	$("#zh02").text(xopnums)
	$("#zh03").text(xodiscount+"元")
	$("#zh04").text(priceCount+"元")
	
	$("#omoney").val(priceCount)
	
	
}
</script> 
<script src="theme/default/WdatePicker.js"></script> 
<script src="theme/layui/layui.js"></script> 
<script src="theme/desktop/js/common.js"></script>

<script>
/*弹出窗口封装代码*/
$(".open-app").on("click",function(){
	var width = $(this).data("width")?$(this).data("width"):900,//获得宽度
	height = $(this).data("height")?$(this).data("height"):400//获得高度
	url = $(this).attr("href")//获得打开URL
	title = $(this).attr("title");//获得标题	
	$.dialog.open(url, {title: title, width:width,height:height, fixed: true});
	return false;	
})
</script>

</body>
</html>
